package priv.yiyuan.example.design.chain;

import java.util.Base64;

/**
 * @author YiYuan
 * @data 2025/10/14
 * @apoNote
 */
public class DataEncryptionProcessor extends DataProcessor {

    public DataEncryptionProcessor() {
        super(new AbstractDataHandler() {
            @Override
            protected void doProcess(RawData data) {
                System.out.println(" 加密核心处理: 简单Base64编码。");
                String encodedContent = Base64.getEncoder().encodeToString(data.getContent().getBytes());
                data.setContent(encodedContent);
                data.addProcessingLog("数据加密");
            }

            @Override
            protected void postProcess(RawData data) {
                System.out.println(" 加密后处理: 记录加密类型。");
            }
        });
    }
}
